<?php

class folderHandling
{
	//Properties
	private $initialFolderName = "../images/";
	private $absoluteFolderPath = "../images/";
	
	//Methods
	public function __construct()
	{
		
	}
	
	private function getUserId()
	{
		return "localhost";
	}
	
	public function getSets()
	{
		if($directoryHandler = opendir($this->initialFolderName))
		{
		$folderArray;
			while(($file = readdir($directoryHandler)) !== false)
			{
				if ($file != "." && $file != ".." && is_dir($this->initialFolderName. $file))
				{
					$folderArray[] = $file;
				}
			}
		return $folderArray;
		}
	}
	
	public function getSmallPhotosForSet($setId)
	{

	}
	
	public function getPhotosForSet($folderName)
	{
		if(is_dir($this->initialFolderName . $folderName))
		{
			if($directoryHandler = opendir($this->initialFolderName . $folderName))
			{
				while(($file = readdir($directoryHandler)) !== false)
				{
					if ($file != "." && $file != ".." && !is_dir($this->initialFolderName . $folderName. "/" . $file))
					{
						$imageArray[] = $this->absoluteFolderPath . $folderName . "/" . $file;
					}
				}
				return $imageArray;
			}
			else
			{
				//Exception, impossible to open the folder
			}
		}
	}
	
	private function executeCall($params)
	{

	}
}

?>